package Day07.Work2;

public class Teacher {
/*    【编号：702】 请定义教师类（Teacher），属性包括姓名和工号。要求分别使用空参和有参构造方法创建对象，
    空参创建的对象通过setXxx赋值，有参创建的对象直接赋值。定义教课（teach）方法，输出“工号为xxx的xxx老师正在讲课”。*/

    private String name;
    private int number;

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setNumber(int number) {
        this.number = number;
    }
    public int getNumber(){
        return number;
    }

    public Teacher(){

    }
    public Teacher(String name,int number){
        this.number =number;
        this.name=name;
    }

    public void teach(){
        System.out.println("工号为"+number+"的老师"+name+"正在讲课");
    }
}
class TestTeacher{
    public static void main(String[] args) {
        Teacher t=new Teacher();
        t.setName("索隆");
        t.getName();
        t.setNumber(333333);
        t.getNumber();

        Teacher t1 =new Teacher("乔治",66666666);
        t.teach();
        t1.teach();
    }
}
